#ifndef AREACONFIG_H
#define AREACONFIG_H

#include <QDialog>
#include <QMenu>
#include <QPoint>
#include <QHash>
#include <QMap>
#include <QMenuBar>
#include "wthread.h"
//#include <QtXlsx>


//extern typedef struct CHANNINFO {
//    QString AreaID;
//    QString ChannelName;
//    QString ChannelType;
//    QString TXFrequency;
//    QString RXFrequency;
//    QString ColorCode;
//    QString Power;
//    QString ChannelMode;
//    QString CallType;
//    QString OutputTimeslot;
//    QString InputTimeslot;
//    QString Volume;
//    QString MicGain;
//}CHANNINFO;

namespace Ui {
class areaConfig;
}

class areaConfig : public QDialog
{
    Q_OBJECT

public:
    explicit areaConfig(wThread *w,QWidget *parent = 0);
    ~areaConfig();
    void table_init();
    void event_init();
    void ment_init();
    void channel_event_init();
    void update_areatable();
    void Updatechannels(int row);
    void update_table(int row);
    void update_channel(int aid,int cid);

private slots:
    void on_add_clicked();
    void on_clean_clicked();
    void RightClickSlot(QPoint pos);               //菜单点击，获取当前位置
    void RightClickSlotchannel(QPoint pos);               //菜单点击，获取当前位置
    void RightClickDelete(QAction *act);
    void RightClickDeletechannel(QAction *act);
    void onClick(QAction *act);
    void onTableClicked(const QModelIndex &index);
    //void onTableClickedchannel(const QModelIndex &index);
    void on_addD_clicked();

    void on_addA_clicked();

    void on_Clean_clicked();

    void exportFile();
    void deal_export();

private:
    Ui::areaConfig *ui;
//    QHash<QString,CHANNINFO> channels;
    QMap<int,CHANNINFO> channels;
    QMap<int,CHANNINFO> channelsTemp;
    QStringList headers;
    QStringList headers2;
    QMenu *OnClick;
    QMenu *RightClick;
    QMenu *RightClickchannel;
    QAction *selectAction;                      //删除事件（如需要其它事件，可新定义）
    QAction *selectActionchannel;
    int iselectcRow;
    int SelectRowID;
    int selectRowchannel;
    QMenuBar *menuBar;
    QMenu *fileMenu;
    wThread *wTh;

};


#endif // AREACONFIG_H
